package com.supreme.nettyapp.generalserver.pingserver;

import com.supreme.nettyapp.generalserver.pingserver.service.PingServerService;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;

@Component
@ConditionalOnProperty(prefix = "netty.ping-server", name = "enabled", havingValue = "true")
public class PingServerStarter {

    @Resource
    private PingServerService pingServerService;

    @PostConstruct
    public void echoServerStarter() {
        pingServerService.startNettyServer();
    }
}
